package com.maxmlr.music.controller;

import com.maxmlr.music.model.Result;
import com.maxmlr.music.model.Song;
import com.maxmlr.music.service.SpecialService;
import com.maxmlr.music.util.Tool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;



/**
 * 
 * @author maxiao
 * 
 */
@Controller
@RequestMapping("/special")
public class SpecialController extends FathController {

	@Autowired
	private SpecialService specialService;

	/**
	 * 加载专辑
	 * 
	 * @param page
	 * @param flag
	 * @param singer_id
	 *            歌手id，送0或空时表示全部
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@ResponseBody
	@RequestMapping("/findSpecial.do")
	public Result findSpecial(Integer page, Integer flag, Integer singer_id,
							  Integer specialnum) {
		Map<String, Object> map = specialService.findSpecial(page, flag,
				singer_id, specialnum);
		Result re = new Result();
		if (TRUE.equals(Tool.dellNull(map.get(FLAG)))) {
			re.setData((List<Song>) map.get(RET));
		}
		return re;
	}
}
